home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 52
/
Amiga Format AFCD52 (Issue 136, May 2000).iso
/
-serious-
/
programming
/
c
/
roboticsdp
/
autodocs
/
minissc.doc
next >
Wrap
Text File
|
2000-02-28
|
19KB
|
658 lines
TABLE OF CONTENTS
minissc.library/ssc_AMove
minissc.library/ssc_ChangeControllerSettings
minissc.library/ssc_ChangeServoSettings
minissc.library/ssc_ControllerRange
minissc.library/ssc_ControllerStatus
minissc.library/ssc_FreeController
minissc.library/ssc_FreeServo
minissc.library/ssc_GetAPosition
minissc.library/ssc_GetPosition
minissc.library/ssc_Move
minissc.library/ssc_OccupyController
minissc.library/ssc_OccupyServo
minissc.library/ssc_Reset
minissc.library/ssc_ResetAll
minissc.library/ssc_ServoRange
minissc.library/ssc_ServoStatus
minissc.library/ssc_SetAPosition
minissc.library/ssc_SetPosition
minissc.library/ssc_AMove minissc.library/ssc_AMove
NAME
ssc_AMove -- Moves servo in proportion to current position
SYNOPSIS
position = ssc_AMove( servo, displacement )
D0 D0 D1
int ssc_AMove(int servo, int displacement);
FUNCTION
This function moves servo in proportion to its current position.
Negative displacement value moves servo anticlockwise and positive value
clockwise.
When called, the related servo will be moved to the calculated position
as quickly as possible.
INPUTS
servo - servo's ID number (0-254)
displacement - displacement value:
negative value = moves servo anticlockwise the amount of given
absolute units
posisitive value = moves servo clockwise the amount of given
absolute units
RESULT
position - new servo position:
-1 = invalid servo ID number
-2 = calculated new servo position is out of range
NOTES
Displacement value refers to an absolute position value. See
SetAPosition() function.
SEE ALSO
ssc_Move()
ssc_SetAPosition()
minissc.library/ssc_ChangeControllerSettingsinissc.library/ssc_ChangeControllerSettings
NAME
ssc_ChangeControllerSettings -- Changes controller settings
SYNOPSIS
error = ssc_ChangeControllerSettings( cntroller, commmode, ctrlmode )
D0 D0 D1 D2
int ssc_ChangeControllerSettings(int cntroller, int commmode, int ctrlmode);
FUNCTION
You can change controller settings by using this function.
See function ssc_OccupyController() for more information about
controller settings.
INPUTS
cntroller - controller's ID number (0-31)
commmode - communication rate:
SSC_COMMMODE_LOW = low; baud rate is 2400
SSC_COMMMODE_HIGH = high; baud rate is 9600
ctrlmode - range of motion:
SSC_CTRLMODE_NARROW = narrow;
allows 90° movements with the accuracy of 0.36°
SSC_CTRLMODE_WIDE = wide;
allows 180° movements with the accuracy of 0.72°
RESULT
error - an error code:
0 = no errors
1 = can't change settings. Controller is not occupied
2 = parameter(s) out of range
NOTES
Controller must be occupied before settings can be changed.
SEE ALSO
ssc_ChangeServoSettings()
ssc_OccupyController()
minissc.library/ssc_ChangeServoSettings minissc.library/ssc_ChangeServoSettings
NAME
ssc_ChangeServoSettings -- Changes servo settings
SYNOPSIS
error = ssc_ChangeServoSettings( servo, range)
D0 D0 D1
int ssc_ChangeServoSettings(int servo, float range);
FUNCTION
You can change servo settings by using this function.
See function ssc_OccupyServo() for more information about servo settings.
INPUTS
servo - servo's ID number (0-15)
range - range of motion (0-180)
RESULT
error - an error code:
0 = no errors
1 = invalid servo number
2 = can't change settings. Servo is not ready
3 = invalid range
NOTES
Servo must be occupied before settings can be changed.
SEE ALSO
ssc_ChangeControllerSettings()
ssc_OccupyServo()
minissc.library/ssc_ControllerRange minissc.library/ssc_ControllerRange
NAME
ssc_ControllerRange -- Gets controller's motion range
SYNOPSIS
range = ssc_ControllerRange( cntroller )
D0 D0
float ssc_ControllerRange(int cntroller);
FUNCTION
This function reads controller's motion range. Result is the current
range in degrees.
INPUTS
cntroller - controller's ID number (0-31)
RESULT
range - controller's motion range:
-1 = controller not available
90 = narrow range
180 = wide range
NOTES
Mini SSC II does not support range queries or any kind of feedback.
Range information provided by this function is therefore based on the
software settings (minissc.library settings) and not on the actual hardware
settings.
You should always make sure that software and hardware settings match.
Otherwise servos will be mispositioned.
SEE ALSO
ssc_OccupyController()
ssc_ServoRange()
minissc.library/ssc_ControllerStatus minissc.library/ssc_ControllerStatus
NAME
ssc_ControllerStatus -- Gets controller's status
SYNOPSIS
status = ssc_ControllerStatus( cntroller )
D0 D0
int ssc_ControllerStatus(int cntroller);
FUNCTION
This function reads controller's status. When invalid controller ID
number has been given, function does not return an error code. Instead,
it gives as a result: "controller not available" (SSC_CTRLR_NA).
INPUTS
cntroller - controller's ID number (0-31)
RESULT
status - Mini SSC II status:
SSC_CTRLR_NA = not available
SSC_CTRLR_BUSY = busy
SSC_CTRLR_READY = ready
SSC_CTRLR_LOCKED = locked
NOTES
Mini SSC II does not support status queries or any feedback. Status
information provided by this function is therefore based on the software
status (minissc.library status) and not on the actual hardware state.
SEE ALSO
ssc_ControllerRange()
ssc_ServoStatus()
minissc.library/ssc_FreeController minissc.library/ssc_FreeController
NAME
ssc_FreeController -- Frees occupied controller
SYNOPSIS
error = ssc_FreeController( cntroller )
D0 D0
int ssc_FreeController(int cntroller);
FUNCTION
This function frees occupied Mini SSC II controller and all its
occupied servos.
INPUTS
cntroller - controller's ID number (0-1)
RESULT
error - an error code:
0 = no errors
1 = not a valid controller ID
2 = can't free controller: it is busy
SEE ALSO
ssc_ControllerSettings()
ssc_ControllerStatus()
ssc_OccupyController()
minissc.library/ssc_FreeServo minissc.library/ssc_FreeServo
NAME
ssc_FreeServo -- Frees occupied servo
SYNOPSIS
error = ssc_FreeServo( servo )
D0 D0
int ssc_FreeServo(int servo);
FUNCTION
This function frees occupied servo.
INPUTS
servo - servo ID number (0-15)
RESULT
error - an error code:
0 = no errors
1 = can't free servo: it is busy or does not exists
SEE ALSO
ssc_OccupyServo()
ssc_ServoSettings()
ssc_ServoStatus()
minissc.library/ssc_GetAPosition minissc.library/ssc_GetAPosition
NAME
ssc_GetAPosition -- Gets absolute position of a servo
SYNOPSIS
position = ssc_GetAPosition( servo )
D0 D0
int ssc_GetAPosition(int servo);
FUNCTION
This function reads current servo position. Result is the servo's
absolute position (0-254).
INPUTS
servo - servo's ID number (0-254)
RESULT
position - absolute position of a servo (0-254)
-1 = can't get position. Servo is not occupied
NOTES
Servo must be occupied before position can be read.
SEE ALSO
ssc_GetPosition()
minissc.library/ssc_GetPosition minissc.library/ssc_GetPosition
NAME
ssc_GetPosition -- Gets position of a servo
SYNOPSIS
position = ssc_GetPosition( servo )
D0 D0
float ssc_GetPosition(int servo);
FUNCTION
This function reads current servo position. Result is the servo's
position in degrees (0-180).
INPUTS
servo - servo's ID number (0-254)
RESULT
position - servo position in degrees (0-180)
-1 = can't get position. Servo is not occupied
NOTES
Servo must be occupied before position can be read.
SEE ALSO
ssc_GetAPosition()
minissc.library/ssc_Move minissc.library/ssc_Move
NAME
ssc_Move -- Moves servo in proportion to current position
SYNOPSIS
position = ssc_Move( servo, displacement )
D0 D0 D1
float ssc_Move(int servo, float displacement);
FUNCTION
This function moves servo in proportion to its current position.
Negative displacement value moves servo anticlockwise and positive value
clockwise.
When called, the related servo will be moved to the calculated position
as quickly as possible.
INPUTS
servo - servo's ID number (0-15)
displacement - displacement value:
negative value = moves servo anticlockwise the amount of given
degrees
posisitive value = moves servo clockwise the amount of given
degrees
RESULT
position - new servo position:
-1 = invalid servo ID number
-2 = calculated new servo position is out of range
NOTES
Displacement value refers to degrees as a position value. See
SetPosition() function.
SEE ALSO
ssc_AMove()
ssc_SetPosition()
minissc.library/ssc_OccupyController minissc.library/ssc_OccupyController
NAME
ssc_OccupyController -- Occupies servo controller
SYNOPSIS
error = ssc_OccupyController( cntroller, commmode, ctrlmode )
D0 D0 D1 D2
int ssc_OccupyController(int cntroller,int commmode,int ctrlmode);
FUNCTION
This function occupies one Mini SSC II controller for your use.
Connection between your Amiga and Mini SSC II is one way only: from
Amiga to Mini SSC II. You can send servo positioning commands to the
Mini SSC II but you can not read any information from the controller or
reconfigure it through the connection.
It is very important that you tell to the minissc.library on what
communication mode and control mode the Mini SSC II is configured by
using this function. Otherwise servos are not positioned correctly or
controller might not work at all.
+--------------------+-----------+ +--------------+-------+----------+
! COMMUNICATION MODE ! BAUD RATE ! ! CONTROL MODE ! RANGE ! ACCURACY !
+--------------------+-----------+ +--------------+-------+----------+
! low ! 2400 ! ! narrow | 90° ! 0.36° !
! high ! 9600 ! ! wide ! 180° ! 0.72° !
+--------------------+-----------+ +--------------+-------+----------+
Mini SSC II has two communication modes and two control modes for
servos. Communication mode indicates how fast computer can send
positioning commands to the controller(s) and the control mode indicates
what motion range and accuracy servos operate on.
Narrow control mode limits servo freedom to 90° while wide mode allows
180° movements. It is advisable to use narrow mode if you have servos
which can not move through a full 180-degree range (see
ssc_ChangeServoSettings() and ssc_OccupyServo() functions for how to
customize a single servo's motion range) or you need the best possible
movement accuracy which Mini SSC II can provide.
It is possible to chain several Mini SSC II controllers together and
thus control more than 8 servos. These chained controllers can have
different control mode settings, but the communication modes may not
differ because controllers share the same serial port. When you occupy
a controller the given communication mode overwrites all other
controllers' communication modes for the reason given above.
See the Mini SSC II manual for how to configure controller.
INPUTS
cntroller - controller's ID number (0-31) to be occupied
commmode - communication rate:
SSC_COMMMODE_LOW = low; baud rate is 2400
SSC_COMMMODE_HIGH = high; baud rate is 9600
ctrlmode - range of motion:
SSC_CTRLMODE_NARROW = narrow;
allows 90° movements with the accuracy of 0.36°
SSC_CTRLMODE_WIDE = wide;
allows 180° movements with the accuracy of 0.72°
RESULT
error - an error code:
0 = no errors
1 = controller has already been occupied
2 = parameter(s) out of range
NOTES
When setting communication and control mode use always definitions
included in minissc.h file:
SSC_COMMMODE_LOW
SSC_COMMMODE_HIGH
SSC_CTRLMODE_NARROW
SSC_CTRLMODE_WIDE
SEE ALSO
ssc_ChangeServoSettings()
ssc_ControllerRange()
ssc_ControllerStatus()
ssc_FreeController()
ssc_OccupyServo()
minissc.library/ssc_OccupyServo minissc.library/ssc_OccupyServo
NAME
ssc_OccupyServo -- Occupies a servo
SYNOPSIS
error = ssc_OccupyServo( servo, range )
D0 D0 D1
int ssc_OccupyServo(int servo, float range);
FUNCTION
By default all servos are disabled. In order to use a servo you must
first occupy it by using this function.
Required parameters are servo ID number (0-254) and servo's motion range.
Mini SSC II controller sets the same maximum motion range to all servos
(90 or 180 degrees). When occupying a servo you can customize the
servo's motion range within the controller's limits. If controller's
motion range is 90° you can, for example, set servo number 0 motion range
to 45° and servo number 1 to 22°. Values exeeding controller's limit are
not allowed.
INPUTS
servo - servo ID number (0-254)
range - range of motion (0-180)
RESULT
error - an error code:
0 = no errors
1 = invalid servo number
2 = servo has already occupied
3 = out of range
4 = can't initialize servo
NOTES
Servo's range can never exceed controller's range.
SEE ALSO
ssc_FreeServo()
ssc_OccupyController()
minissc.library/ssc_Reset minissc.library/ssc_Reset
NAME
ssc_Reset -- Resets a servo
SYNOPSIS
error = ssc_Reset( servo )
D0 D0
int ssc_Reset(int servo);
FUNCTION
This function moves servo to its initial position (center).
INPUTS
servo - servo ID number (0-254)
RESULT
error - an error code:
0 = no errors
1 = can't reset servo. It's not ready
SEE ALSO
ssc_AMove()
ssc_Move()
ssc_ResetAll()
ssc_SetAPosition()
ssc_SetPosition()
minissc.library/ssc_ResetAll minissc.library/ssc_ResetAll
NAME
ssc_ResetAll -- Resets all servos
SYNOPSIS
error = ssc_ResetAll()
D0
int ssc_ResetAll(void);
FUNCTION
This function moves all servos to their initial positions.
INPUTS
None
RESULT
None
SEE ALSO
ssc_Reset()
minissc.library/ssc_ServoRange minissc.library/ssc_ServoRange
NAME
ssc_ServoRange -- Gets servo's motion range
SYNOPSIS
range = ssc_ServoRange( servo )
D0 D0
float ssc_ServoRange(int servo);
FUNCTION
This function reads servo's motion range. Result is the current range in
degrees.
INPUTS
servo - servo's ID number (0-15)
RESULT
range - servo's motion range (0-180 degrees):
-1 = unable to get servo range
SEE ALSO
ssc_ControllerRange()
ssc_OccupyServo()
minissc.library/ssc_ServoStatus minissc.library/ssc_ServoStatus
NAME
ssc_ServoStatus -- Gets servo's status
SYNOPSIS
status = ssc_ServoStatus( servo )
D0 D0
int ssc_ServoStatus(int servo);
FUNCTION
This function reads servo's status.
INPUTS
servo - servo's ID number (0-15)
RESULT
status - servo's status:
SSC_SERVO_NA = not available
SSC_SERVO_BUSY = busy
SSC_SERVO_READY = ready
SSC_SERVO_LOCKED = locked
NOTES
Mini SSC II does not support status queries or any feedback. Status
information provided by this function is therefore based on the software
status (minissc.library status) and not on the actual hardware state.
SEE ALSO
ssc_ControllerStatus()
ssc_ServoRange()
minissc.library/ssc_SetAPosition minissc.library/ssc_SetAPosition
NAME
ssc_SetAPosition -- Moves servo to the new position
SYNOPSIS
error = ssc_SetAPosition( servo, position )
D0 D0 D1
int ssc_SetAPosition(int servo, int position);
FUNCTION
Servo can be positioned by using this function. It requires two
parameters: servo ID number (0-254) and absolute position (0-254).
Servo ID number identifies the servo to be moved and the position
argument to which position you want to move the servo. When function is
called, the related servo will be moved to the desired position as
quickly as possible.
INPUTS
servo - servo's ID number (0-254)
position - new absolute position (0-254)
RESULT
error - an error code:
0 = no errors
1 = invalid servo
2 = invalid position
3 = transmission error
NOTES
This is the most accurate way of moving a servo.
SEE ALSO
ssc_GetAPosition()
ssc_SetPosition()
minissc.library/ssc_SetPosition minissc.library/ssc_SetPosition
NAME
ssc_SetPosition -- Moves servo to the new position
SYNOPSIS
error = ssc_SetPosition( servo, position )
D0 D0 D1
int ssc_SetPosition(int servo, float position);
FUNCTION
Servo can be positioned by using this function. It requires two
parameters: servo ID number (0-254) and position in degrees (0-180).
Servo ID number identifies the servo to be moved and the position
argument to which position you want to move the servo. When function is
called, the related servo will be moved to the desired position as
quickly as possible.
INPUTS
servo - servo's ID number (0-254)
position - new servo position in degrees (0-180)
RESULT
error - an error code:
0 = no errors
1 = invalid servo
2 = invalid position
3 = transmission error
SEE ALSO
ssc_GetPosition()
ssc_SetAPosition()